const fs = require('fs');
const prompts = require('prompts')
const getDirectoriesSync = (path) => {
  try {
    const files = fs.readdirSync(path);
    return files.filter(file => fs.statSync(path + '/' + file).isDirectory());
  } catch (err) {
    console.error(err);
    return [];
  }
};

const files = getDirectoriesSync('./src/project');
const options = [{
  type: 'select',
  name: 'value',
  message: '请选择项目',
  choices: files.map(file => ({ title: file, value: file }))
}]
prompts(options).then(res => {
  fs.writeFile('.development', res.value, 'utf8', ()=>{})
})
